/**
 * @author Jason Tong
 * @date 2019/5/5 12:35.
 */

import javax.swing.*;
public class MySQL3 {
    public static void main(String args[]) {
        String [] tableHead;
        String [][] content;
        JTable table ;
        JFrame win= new JFrame();
        Query findRecord = new  Query();
        findRecord.setDatabaseName("world");
        findRecord.setSQL("select * from country where LifeExpectancy = (select max(LifeExpectancy)from country) ");
        content = findRecord.getRecord();
        tableHead=findRecord.getColumnName();
        table = new JTable(content,tableHead);
        win.add(new JScrollPane(table));
        win.setBounds(12,100,400,200);
        win.setVisible(true);
        win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}

